<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
<script src="${ctx}/js/controllers/base/shopinfo/shopAppliacationController.js" type="text/javascript"></script>
<style type="text/css">
em {
	border-right: 1px solid #565252;
	margin-right: 3px;
}

</style>

<section>

    <div style="height: 40px; line-height: 40px;">
        <div class="forword_area"></div>
        <div class="location">当前位置：${sessionScope.currcent_position}</div>
    </div>
    <hr>
    
    <section>
        <!--begin 搜索栏 -->
        <div class="panel">
            <div style="float: left; height: 28px;">
                <input id="name" type="text" maxlength="20" value="${(not empty name)? name : ''  }" class="input-sm" placeholder="联系人">
            </div>
            <div class="btn-group">
                <select class="dropdown-menu" id="pSize">
                    <c:forEach items="${pageSizes }" var="item">
                        <option value="${item.value }" <c:if test="${pSize == item.value }">selected</c:if>>&nbsp;&nbsp;&nbsp;${item.label }</option>
                    </c:forEach>
                </select>
            </div>
            <div class="btn-group">
                <select class="dropdown-menu" id="approveState">
                    <c:forEach items="${applyingState}" var="item">
                        <option value="${item.value }" <c:if test="${approveState == item.value }">selected</c:if>>${item.label }</option>
                    </c:forEach>
                </select>
            </div>
            <div class="form-control">
                <div class="search" onclick="getShopInfoList();">
                    <img src="${ctx }/images/table/search_second.png">
                </div>
                <%-- <div class="delete"  style="float:left;" onclick="deleteByIds();"><img src="${ctx }/images/table/del_second.png"></div>  --%>
            </div>
        </div>
        <!--end 搜索栏 -->

        <!--begin table表格 -->
        <div>
            <table class="table">
                <thead>
                    <tr>
                        <%--  <th width="3%">
                           <img id="all" onclick="selectAll(this)" src="${ctx }/images/tables/wugou.png" style="margin-bottom: 1px;">
                        </th> --%>
                        <th width="5%">序号</th>
                        <th width="12%">小区名</th>
                        <th width="12%">店铺名称</th>
                        <th width="8%">注册资本(万元)</th>
                        <th width="6%">联系人</th>
                        <th width="6%">公司电话</th>
                        <th width="8%">状态</th>
                        <th width="12%">审核操作</th>
                    </tr>
                </thead>
                <tbody id="tableTbody">
                    <c:forEach items="${shopinfoList.list }" var="shopInfo" varStatus="shopInfoStatus">
                        <tr onmouseover="mouseoverOne(this)" onmouseout="mouseoutOne(this)">
                            <%--  <td>
                            <img id="shop${shopInfo.id}" name="cellChecked" class="${shopInfo.id}" onclick="selectOne(${shopInfo.id},this)" src="${ctx }/images/tables/wugou.png">
                            </td> --%>
                            <td>${shopInfoStatus.index + 1 }
                            <input id="menuId" type="hidden" value="${sessionScope.user_login.menu.id}"/>
                            <input id="cellId" type="hidden" value="${shopInfo.cellId}"/>
                            </td>
                            <td>${shopInfo.cellName}</td>
                            <c:choose>
                                <c:when test="${fn:length(shopInfo.name) > 15}">
                                    <td id="addr${shopInfo.id}" onmouseover="mouseOverAddr(${shopInfo.id} , '${shopInfo.name}')" onmouseout="mouseOutAddr(${shopInfo.id} , '${shopInfo.name}')">${fn:substring(shopInfo.name , 0 , 15)}...</td>
                                </c:when>
                                <c:otherwise>
                                    <td id="addr${shopInfo.id}">${shopInfo.name}</td>
                                </c:otherwise>
                            </c:choose>
                            <c:choose>
                                <c:when test="${null != shopInfo.registerMoney}">
                                    <td>${shopInfo.registerMoney}</td>
                                </c:when>
                                <c:otherwise>
                                    <td>——</td>
                                </c:otherwise>
                            </c:choose>
                            <td>${shopInfo.contactor}</td>
                            <td>${shopInfo.companyPhone}</td>
                            <td>
                                <c:choose>
                                    <c:when test="${shopInfo.state == 1}">新申请</c:when>
                                    <c:when test="${shopInfo.state == 2}">正常</c:when>
                                    <c:when test="${shopInfo.state == 3}">禁用</c:when>
                                    <c:when test="${shopInfo.state == 4}">暂停营业</c:when>
                                    <c:when test="${shopInfo.state == 5}">审核未通过</c:when>
                                </c:choose>
                            </td>
                            <td>
                                <a onclick="showDetail('${shopInfo.id}');">详情</a>
                                <span>&nbsp;|&nbsp;</span><a onclick="addMemo('${shopInfo.id}');">[添加备注]</a>
                                <c:choose>
                                    <c:when test="${shopInfo.state == 1}">
                                         <span>&nbsp;|&nbsp;</span><a onclick="approve('${shopInfo.id}','2')">通过</a>
                                         <span>&nbsp;|&nbsp;</span><a onclick="approve('${shopInfo.id}','5')">不通过</a>
                                    </c:when>
                                </c:choose>
                                
                            </td>
                        </tr>
                    </c:forEach>
                </tbody>

                <tfoot>
                    <tr>
                        <td colspan="10">
                            <div>
                                <div style="float: left;">
                                    <span class="total">合计 ${shopinfoList.total} 条数据</span>
                                </div>
                                <div style="float: right; margin-right: 10px; margin-top: 26px">
                                    <div style="float: left;">
                                        <ul class="footer_ul">
                                            <c:if test="${shopinfoList.hasPreviousPage }">
                                                <li onclick="gotoPage(${currentPage-1 });"><a class="leftRight">&lt;&lt;</a></li>
                                            </c:if>
                                            <c:if test="${shopinfoList.firstPage > 1}">
                                                <li onclick="gotoPage(1);" style="border: 1px solid #9A9A9A;"><a>1</a></li>
                                                <c:if test="${shopinfoList.firstPage > 2}">
                                                ...
                                            </c:if>
                                            </c:if>
                                            <c:forEach items="${shopinfoList.navigatepageNums }" var="page">
                                                <li onclick="gotoPage(${page });" class="<c:if test="${currentPage == page }">active</c:if>" style="border: 1px solid #9A9A9A;"><a>${page}</a></li>
                                            </c:forEach>
                                            <c:if test="${shopinfoList.lastPage < shopinfoList.pages}">
                                                <c:if test="${shopinfoList.firstPage < shopinfoList.pages - 1}">
                                                ...
                                            </c:if>
                                                <li onclick="gotoPage(${shopinfoList.pages});" style="border: 1px solid #9A9A9A;"><a>${shopinfoList.pages}</a></li>
                                            </c:if>
                                            <c:if test="${shopinfoList.hasNextPage }">
                                                <li><a onclick="gotoPage(${currentPage+1});" class="leftRight">&gt;&gt;</a></li>
                                            </c:if>
                                        </ul>
                                    </div>
                                    <div style="float: left; height: 30px; line-height: 30px;">
                                        <span style="color: #9A9A9A;">跳转到</span> <input class="inputclass" id="pageNo" onkeydown="if(event.keyCode==13){event.keyCode=0;return false;}" type="text"
                                            value="${currentPage }" style="width: 26px; height: 28px"> <span style="color: #9A9A9A;">页</span> <span class="buttonclass" id="J_JumpTo"
                                            onclick="gotoShopInfoPage(null);"><a>GO</a></span>
                                    </div>
                                </div>
                            </div>
                        </td>
                    </tr>
                </tfoot>
            </table>

        </div>
        <%@include file="/views/common/footer.jsp"%>
    </section>
</section>

<script type="text/javascript">
        var ctx = '${ctx}';
        setCtx(ctx);
        
        //实现选中取消切换图片
        $("tbody td>img").toggle(function(){    
            $(this).attr("src","${ctx }/images/tables/honggou.png"); 
            //$(this).parents("tr").children().each(function(){
               // $(this).css("background","#D3F0F1");
           //});    
        },function(){    
            $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
            //$(this).parents("tr").children().each(function(){
                //$(this).css("background","");
           //});
            });
            
        //实现全选切换所有选项图标
        $("#all").toggle(function(){    
            $(this).attr("src","${ctx }/images/tables/honggou.png"); 
            $("tbody td>img").attr("src","${ctx }/images/tables/honggou.png");  
        },function(){    
            $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
            $("tbody td>img").attr("src","${ctx }/images/tables/wugou.png");  
            });
        
    </script>
<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>
